package com.kzj.pojo.dto;

import com.kzj.annotation.OnCreate;
import com.kzj.annotation.OnEdit;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.time.LocalDate;

@Data
public class TeacherUpdateDto {
    @Positive
    @NotNull(groups = OnEdit.class, message="更新时未发现老师Id")
    private Long id;
    @NotBlank
    @Size(min = 2,max=20)
    private String name;
    @NotBlank
    @Pattern(regexp = "^男|女$",message = "性别只能是男或者女")
    private String gender;
    @Past
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private LocalDate birthday;
    @NotBlank
    @Size(min = 11,max = 11)
    private String phone;
    @Email
    private String email;
}
